package h0731;

import java.util.*;

/**
  * @description 整数对最小和
  * @author 不知名帅哥
  * @date 2024/7/31 22:32
  * @version 1.0
*/
public class MinSumInteger {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n1 = sc.nextInt();
        int[] a=new int[n1];
        for (int i = 0; i < n1; i++) {
            a[i]=sc.nextInt();
        }
        int n2=sc.nextInt();
        int[] b=new int[n2];
        for (int i = 0; i < n2; i++) {
            b[i]=sc.nextInt();
        }
        //要求的对数
        int m=sc.nextInt();
        System.out.println(getRes(a, b, n1, n2, m));
    }

    private static int getRes(int[] a, int[] b, int n1, int n2, int m) {
        LinkedHashMap<int[],Integer> map=new LinkedHashMap<>();
        //双重for循环
        for (int i = 0; i < n1; i++) {
            for (int j = 0; j < n2; j++) {
                map.put(new int[]{i,j},a[i]+b[j]);
            }
        }

//        List<int[]> list=new ArrayList<>(map.keySet());
        ArrayList<Integer> ans = new ArrayList<>(map.values());
        ans.sort(Integer::compare);
        int sum=0;
        for (int i = 0; i < m; i++) {
            sum+=ans.get(i);
        }
        return sum;
    }
}
